import java.sql.SQLOutput;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;

public class Test {

    public static void main(String[] args) {
        int[] A = {25, 34, 256, 9, 38, 47, 128, 256, 64};

        System.out.println(f30(A, 5));
        System.out.println(f30(A, 9));
    }

    public static int f30(int[] A, int n) {
        int m;
        if (n <= 0) return -1;
        if (n == 1) return 0;
        m = f30(A, n - 1);
        if (A[m] > A[n - 1]) return m;
        else return n - 1;
    }

    @org.junit.Test
    public void test1(){
        List<Integer> list = Arrays.asList(1, 7, 1, 3, 4, 6, 1, 6, 8);
        HashSet<Integer> set = new HashSet<>();
        set.addAll(list);
        set.forEach(System.out::println);

    }
}
